using ProtoScratch.Server;
using ProtoScratch.Client;
using System.Security.Cryptography;

namespace TestSpace
{
	class MainClass
	{
		//Here is a sample of ProtoScratch usage!
		public static void Main (string[] args)
		{
			var RSA = new RSACryptoServiceProvider().ExportParameters(true);
			//The following lines of code create a new ProtoScratch server instance.
			//ProtoScratch can be used without setting any of the variables (key, version, etc.)
			//but doing so helps make your instance unique.
			//See the "ServerSample" class to see how the communication is implemented.
			var server = new ScratchServer(typeof(ServerSample), 5000);
			server.setKey(543212345);
			server.setVersion(1,0);
			server.rsaKey = RSA;
			server.start();
			
			//Same as above, but the client implementation. This will connect to localhost.
			//Note that each time connect() is called, ProtoScratch will spawn a new thread for the
			//new connection.
			//See the "ClientSample" class to see how the communication is implemented.
			var client = new ScratchClient(typeof(ClientSample), 5000);
			client.setKey(543212345);
			client.setVersion(1,0);
			client.rsaKey = RSA;
			client.connect("localhost");
		}
	}
}
